<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    /* 
      三个数字从大到小排列
    */
    var a = 10;
    var b = 20;
    var c = 30;
    console.log("排序之前的输出结果：", a, b, c); // 10 20 30
    // a 和 b比较
    if(a < b) {
      var temp = a;
      a = b;
      b = temp;
    }
    console.log("a和b比较之后的输出结果：", a, b, c); // 20 10 30
    // b 和 c 比较
    if(b < c) {
      var temp = b;
      b = c;
      c = temp;
    }
    console.log("b和c比较之后的结果：", a, b, c); // 20 30 10
    // 把a 和 b 再次比较
    if(a < b) {
      var temp = a;
      a = b;
      b = temp;
    }
    console.log("最终输出结果：", a, b, c); // 30 20 10
  </script>
</body>
</html>